08. Solution: Building Java Applications
Solution: Building Java Applications
ND079 JPND C3 L1 A06 Solution Building Java Applications V2
To compile this Java code into class files, you can use the command:
javac UserValidatorExample.java
Once you have created all the class files, you can package them using the jar
command with the statement:
jar -cfe validator.jar UserValidatorExample *.class
This statement uses the -c
flag to create a new jar, the -f
flag to specify the filename validator.jar and the -e
flag to provide the class to use as an entry point, UserValidatorExample
. It creates the jar using all the files in the current directory with the class extension.
Finally, you can run the jar using the command:
java -jar validator.jar
You should see the output of the main class running, which is:
false
true
true
false
`